import React, { Component } from 'react'
import './index.css'
import axios from 'axios';
export default class DouYinDetail extends Component {
    //声明 state
    state = {
        data: {}
    }
    render() {
        return (
            <div className="video-container">
                <div className="video">
                    <video controls src={"http://127.0.0.1:8090" + this.state.data.video_local}></video>
                </div>
            </div>
        )
    }

    async componentDidMount(){
        //获取 id
        let id = this.props.match.params.id;
        //发送AJAX请求获取该 id 对应的数据
        let result = await axios.get('http://127.0.0.1:8090/douyin/' + id);
        //查看结果
        this.setState({
            data: result.data
        })
    }
}
